execute store result score #index temp run data get storage vs:system temp.GSG.index

execute store result storage vs:system temp.GSG.index int 1 run scoreboard players remove #index temp 1
execute if score #index temp matches ..-1 run return run scoreboard players reset #index temp

function vs:item/geomagnetic_storm_generator/invalidation_reactions/invalidation with storage vs:system temp.GSG